import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsUrl, IsOptional, IsBoolean, IsNumber, MinLength, MaxLength } from 'class-validator';

export class CreateBannerDto {
  @ApiProperty({
    description: '轮播图标题',
    example: '欢迎访问我的博客',
    minLength: 2,
    maxLength: 100,
  })
  @IsString()
  @MinLength(2)
  @MaxLength(100)
  title: string;

  @ApiProperty({
    description: '轮播图描述',
    example: '这里有最新的技术文章和个人分享',
    minLength: 10,
    maxLength: 500,
  })
  @IsString()
  @MinLength(10)
  @MaxLength(500)
  description: string;

  @ApiProperty({
    description: '轮播图图片URL',
    example: 'https://example.com/banner.jpg',
  })
  @IsUrl()
  imageUrl: string;

  @ApiProperty({
    description: '轮播图点击链接',
    example: 'https://example.com',
  })
  @IsUrl()
  link: string;

  @ApiProperty({
    description: '是否激活',
    example: true,
    default: true,
    required: false,
  })
  @IsOptional()
  @IsBoolean()
  isActive?: boolean;

  @ApiProperty({
    description: '排序顺序',
    example: 0,
    default: 0,
    required: false,
  })
  @IsOptional()
  @IsNumber()
  order?: number;
}